from typing import Optional, List
from src.model.crawler import ResultDataBase
from src.enum.result import ResultDataTypeEnum, FlightStatusEnum
from pydantic import BaseModel

class AwbCargoEvent(BaseModel):
    event_time: Optional[str] = None
    status_code: Optional[str] = None
    event_desc: Optional[str] = None
    station: Optional[str] = None
    flight_desc: Optional[str] = None
    pieces: Optional[int] = None
    weight: Optional[str] = None
    volume: Optional[str] = None
    remark: Optional[str] = None

class AwbFlight(BaseModel):
    flight_no: int = 0
    flight_number: Optional[str] = None
    flight_date: Optional[str] = None
    s_airport: Optional[str] = None
    e_airport: Optional[str] = None
    flight_status: FlightStatusEnum = FlightStatusEnum.UN_TAKE_OFF
    pieces: Optional[int] = None
    volume: Optional[str] = None
    weight: Optional[str] = None
    flight_etd: Optional[str] = None
    flight_atd: Optional[str] = None
    flight_eta: Optional[str] = None
    flight_ata: Optional[str] = None

class AwbResult(ResultDataBase):
    data_type: ResultDataTypeEnum = ResultDataTypeEnum.AIR_WAYBILL
    type_version: str = "v2"
    is_over: int = 0
    orig_airport: Optional[str] = None
    dest_airport: Optional[str] = None
    goods_desc: Optional[str] = None
    total_pieces: Optional[int] = None
    total_weight: Optional[str] = None
    total_volume: Optional[str] = None
    flight_list: List[AwbFlight] = []
    event_list: List[AwbCargoEvent] = []
